package ywpt.service.config;

import ywpt.core.dao.HibernateEntityDao;
import ywpt.model.CommonTable;
import ywpt.model.ProjectInfo;
import ywpt.model.ProjectScans;

public class ProjectScansServiceImpl extends HibernateEntityDao<ProjectScans> implements ProjectScansService{

	@Override
	public ProjectScans getProjectScansById(Long id) {
		return this.get(id);
	}

	@Override
	public void saveProjectScans(ProjectScans ps, Long projectId,Long scanTypeId) {
		if (projectId!=null) {
			ps.setProject(this.get(ProjectInfo.class, projectId));
		}
		if (scanTypeId!=null) {
			ps.setType(this.get(CommonTable.class,scanTypeId));
		}
		super.save(ps);
	}

	@Override
	public void removeProjectScansById(Long id) {
		this.removeById(id);
	}

}
